package com.lwl.office.webeditor.parser;

import com.lwl.office.webeditor.ParserContext;
import com.lwl.office.webeditor.style.PStyle;
import com.lwl.office.webeditor.style.Style;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.jsoup.nodes.Node;

public class PNodeParser extends NodeParser{
    @Override
    public void parser(ParserContext context, Style style) {
        XWPFParagraph paragraph = context.createParagraph();
        parser(paragraph,context,style);
    }
    public void parser(XWPFParagraph paragraph,ParserContext context, Style style) {
        PStyle pStyle = style instanceof PStyle ?(PStyle) style:new PStyle();
        pStyle.of(getNode().attr(
                "style"));
        pStyle.rendParagraph(paragraph);
        //p标签下面再无段落
        for (Node node : getNode().childNodesCopy()) {
            ParserSelector.select(node).parser(context,null);
        }
    }
}
